package cc.openkit.admin.util;

/**
 * 分页工具类
 */
public class Pager {
    private int pageNum;
    private int pageRows;
    private int pageStartIndex;
    private int pageEndIndex;

    public Pager() {}

    public Pager(int pageNum, int pageRows) {
        this.pageNum = pageNum;
        this.pageRows = pageRows;

        /**
         * ORACLE
         this.pageFirstIndex = (pageNum-1)*pageRows+1;
         this.pageEndIndex = pageNum*pageRows;
         **/

        /***MYSQL*/
        this.pageStartIndex = (pageNum-1)*pageRows;
        this.pageEndIndex = pageRows;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageRows() {
        return pageRows;
    }

    public void setPageRows(int pageRows) {
        this.pageRows = pageRows;
    }

    public int getPageStartIndex() {
        return pageStartIndex;
    }

    public void setPageStartIndex(int pageStartIndex) {
        this.pageStartIndex = pageStartIndex;
    }

    public int getPageEndIndex() {
        return pageEndIndex;
    }

    public void setPageEndIndex(int pageEndIndex) {
        this.pageEndIndex = pageEndIndex;
    }
}
